package gui.Stu;
import info.User;
import sql.Connect;
import javax.swing.*;
import java.awt.*;

public class StuMain extends JFrame {
    private CardLayout cardLayout;
    private JPanel mainPanel;
    public StuMain(Connect conn, User user) {
        setTitle("请假系统");
        Toolkit kit =Toolkit.getDefaultToolkit();
        Dimension screenSize = kit.getScreenSize();
        setSize(screenSize.width/2, screenSize.height/2);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        setResizable(false);

        //创建面板
        cardLayout = new CardLayout();
        mainPanel = new JPanel(cardLayout);
        mainPanel.add(new Subscribe().createSubscribe(cardLayout,mainPanel,conn,user), "Subscribe");
        mainPanel.add(new History().createHistory(cardLayout,mainPanel,conn,user), "History");
        add(mainPanel);
        setVisible(true);
    }

}
